import Cookies from 'js-cookie'

const app = {
    state: {
        skmenu: {
            opened: !+Cookies.get('skmenuStatus')
        },
        sidebar: {
            opened: true
            // !+Cookies.get('sidebarStatus')
        },
        divtab: {
            tab: '1'
        },
        stafftab: {
            tab: '1'
        },
        pendingCase: {
            obj: {}
        },
        skyReportCriteria: {
            obj: {}
        }
    },
    mutations: {
        TOGGLE_STAFFTAB: (state, tab) => {
            state.tab = tab
            // if (state.stafftab.tab) {}
        },
        TOGGLE_DIVTAB: (state, tab) => {
            state.tab = tab
        },
        TOGGLE_SIDEBAR: state => {
            // Cookies.set('sidebarStatus', +state.sidebar.opened)
            // state.sidebar.opened = !state.sidebar.opened
        },
        TOGGLE_PENDINGCASE: (state, obj) => {
            state.obj = obj
        },
        TOGGLE_REPORTCRITERIA: (state, obj) => {
            state.obj = obj
        }
    },
    actions: {
        ToggleSideBar: ({
            commit
        }) => {
            commit('TOGGLE_SIDEBAR')
        },
        ToggleStaffTab: ({
            commit
        }) => {
            commit('TOGGLE_STAFFTAB')
        },
        ToggleDivTab: ({
            commit
        }) => {
            commit('TOGGLE_DIVTAB')
        },
        TogglePendingCase: ({
            commit
        }) => {
            commit('TOGGLE_PENDINGCASE')
        },
        ToggleReportCriteria: ({
            commit
        }) => {
            commit('TOGGLE_REPORTCRITERIA')
        }
    }
}

export default app
